package com.itheima.mapper;

import com.itheima.pojo.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface EmployeeMapper {
    @Select("select * from employee where username = #{username}")
    Employee selectByUserName(@Param("username") String username);

    @Insert("insert into employee values(null,#{name},#{username},#{password},#{phone},#{sex},#{idNumber},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    int insert(Employee employee);
    //limit  参数1  起始位置   参数2 查询得条数
    @Select("select * from employee limit #{page},#{pageSize}")
    List<Employee> seletAll(@Param("page") int page, @Param("pageSize") int pageSize);

    @Select("select * from employee where name like #{name} limit #{page},#{pageSize}")
    List<Employee> selectByLikeName(@Param("page")int page, @Param("pageSize")int pageSize, @Param("name") String name);
    //1 比 * 得性能高
    @Select("select count(1) from employee")
    int selectCount();
}
